const state = {
  menu: [], //菜单权限信息
  paths: [], // 页面权限列表,防止地址栏输入跳转
  roles: [] //按钮权限,数据页面变化而变化
}
function menuEcah(menu) {
	menu.forEach((m,index) => {
		if(m.path && m.path.trim()!='') {
			state.paths.push(m.path.trim())
		}
		else if(m.children && m.children.length >= 1) {
			menuEcah(m.children)
		}

	})
}
const mutations = {
  SET_MENU: (state, menus) => {
    state.menu = menus
		state.paths = []
		menuEcah(menus)
  },
  SET_ROLES: (state, roles) => {
    state.roles = roles
  }
}

const actions = {

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
